package com.zsh.mybatis.controller;

import com.zsh.mybatis.bean.Employee;
import com.zsh.mybatis.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author zsh
 * @Description
 * @create 2022-02-08 15:22
 */
@Controller
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("/emps")
    public String emps(Model model){
        List<Employee> employees = employeeService.getEmployees();
        model.addAttribute("employees",employees);
        return "list";
    }
}
